const channel=new MessageChannel();
const factoralWorker=new Worker("./worker.js");

console.log(channel);

factoralWorker.postMessage(null,[channel.port1]);
channel.port2.onmessage=({data})=>{
    console.log(data);
    const ele=document.querySelector("#result")
    let dom=document.createElement("div")
    dom.innerText=data;
    ele.appendChild(dom)
}
channel.port2.postMessage(4);
channel.port2.postMessage(8);
channel.port2.postMessage(10);
channel.port2.postMessage(100);
channel.port2.postMessage(170);

